# Maintainer: Jan de Groot <jgc@archlinux.org>
# Maintainer: Andreas Radke <andyrtr@archlinux.org>

pkgname='mesa-demos'
pkgver=8.4.0
pkgrel=4
arch=('x86_64')
pkgdesc="Mesa demos and tools incl. glxinfo + glxgears"
url="https://www.mesa3d.org/"
license=('custom')
depends=('libgl' 'glew' 'freeglut')
makedepends=('mesa' 'freetype2' 'git')
source=(https://mesa.freedesktop.org/archive/demos/mesa-demos-$pkgver.tar.bz2{,.sig}
        'LICENSE')
sha512sums=('b72d03cad36e0535ff18dcfb222ec4200064b9264f6da51a6e5f03b0dd912abe188bc1d600b6698de3ce6f63b28d2ce01565886ca8e7079edc4967fbf2fb0957'
            'SKIP'
            '25da77914dded10c1f432ebcbf29941124138824ceecaf1367b3deedafaecabc082d463abcfa3d15abff59f177491472b505bcb5ba0c4a51bb6b93b4721a23c2')
validpgpkeys=('E390B9700582FAEA959ACAD41EEF53D38A3A9C67') # "Andreas Boll <andreas.boll.dev@gmail.com>"

build() {
  cd mesa-demos-$pkgver
  ./configure --prefix=/usr \
    --disable-gles1 \
    --with-system-data-files=/usr/share/mesa-demos
  make
}

package() {
  cd mesa-demos-$pkgver
  make DESTDIR="${pkgdir}" install
  
  # add missing egl files
  install -m 0755 src/egl/opengl/{eglgears_x11,eglinfo,eglkms,egltri_x11,peglgears,xeglgears,xeglthreads} "${pkgdir}/usr/bin/"
  
  install -m755 -d "${pkgdir}/usr/share/licenses/mesa-demos"
  install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/mesa-demos/"
}
